/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.support;

import java.util.Collection;

/**
 *
 * @author Rakev
 */
public class RegexFactory {
    
    public String anyOf(String... regexs){
        String totalRegex = "";
        for (String regex : regexs) {
            totalRegex += "|(" + regex + ")";
        }
        totalRegex = totalRegex.substring(1);
        return totalRegex;        
    }
    
    public String anyOf(Collection<String> regexs){
        String totalRegex = "";
        for (String regex : regexs) {
            totalRegex += "|(" + regex + ")";
        }
        totalRegex = totalRegex.substring(1);
        return totalRegex;        
    }
    
    public String allOf(String... regexs){
        String totalRegex = "";
        for (String regex : regexs) {
            totalRegex += "&(" + regex + ")";
        }
        totalRegex = totalRegex.substring(1);
        return totalRegex;        
    }
    
    public String allOf(Collection<String> regexs){
        String totalRegex = "";
        for (String regex : regexs) {
            totalRegex += "&(" + regex + ")";
        }
        totalRegex = totalRegex.substring(1);
        return totalRegex;        
    }
    
}
